<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>列表</title>
    <c:set value="${pageContext.request.contextPath}" var="path" scope="page" />
    <link rel="stylesheet" href="${path}/static/style/list.css">
    <script src="${path}/static/script/jQuery 3.5.1.min.js"></script>
</head>

<body>
	<form class="select" action="/Discovery/sel" method="post">
		<div class="select-item">
			<label>开始时间</label><input type="text" name="begintime" value="${param.begintime}" />		
		</div>
		<div class="select-item">
			<label>结束时间</label><input type="text" name="endtime" value="${param.endtime}" />
		</div>
		<div class="select-item"></div>
		<div class="select-item">
			<input type="submit" class="btn sel-btn" value="查询" />
		</div>
	</form>
    <table class="table-fill">
        <thead>
            <tr>
                <th class="text-center">标题</th>
                <th class="text-center">相片</th>
                <th class="text-center">发现者</th>
                <th class="text-center">发现日期</th>
                <th class="text-center">
                    <a href="/Discovery/index" class="btn">首页</a>
                </th>
            </tr>
        </thead>
        <tbody class="table-hover">
            <c:forEach var="item" items="${list}">
                <tr>
                    <td class="text-center">${item.title}</td>
                    <td class="text-center"><img src="/imagesdir/${item.imgname}" class="discovery-img" /></td>
                    <td class="text-center">${item.user.username}</td>
                    <td class="text-center">
                        <fmt:formatDate value="${item.date}" pattern="yyyy-MM-dd" />
                    </td>
                    <td class="text-center">
                        <a href="del?id=${item.id}" onclick="return confirm('你确定要删除吗?');" class="btn">删除</a>
                    </td>
                </tr>
            </c:forEach>
        </tbody>
    </table>
</body>

</html>